<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>addCounter函数累加器</title>
</head>
<body>

<button onclick="addOne()">加1(函数累加器)</button>

<script>
    function addOne() {
        counter();
    }
    function add(){
        var count = 0;
        function demo(){
            count ++;
            console.log(count);
        }
        return demo;
    }
    var counter = add();

</script>

</body>
</html>
